import Vue from 'vue'
import App from './App.vue'
import router from './router'
import axios from 'axios'
// 导入并安装 Vant 组件库
import Vant from 'vant'

// 切记：为了能够覆盖默认的 less 变量，这里一定要把后缀名改为 .less
import 'vant/lib/index.less'


// axios
//request请求拦截
axios.interceptors.request.use(config => {
   // 添加请求头
   config.headers.Authorization= window.localStorage['token']
   // 必须返回config

   return config
})


//response响应拦截
axios.interceptors.response.use(config => {
  // 自行定义需要的操作
 
  // 必须返回config
  return config
})

// Vue.prototype.$axios = axios
Vue.prototype.$axios = axios

Vue.use(Vant)

Vue.config.productionTip = false

new Vue({
  axios,
  router,
  render: h => h(App),
  beforeCreate() {
    Vue.prototype.$bus = this//安装全局事件总线
}
}).$mount('#app')
